
package com.ruoyi.web.controller.lingshui.surveyResults;


import java.util.ArrayList;
import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ruoyi.common.config.Global;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.exception.LSBusinessException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.supervise.domain.Affix;
import com.ruoyi.supervise.domain.CheckConclu;
import com.ruoyi.supervise.domain.Emphasize;
import com.ruoyi.supervise.domain.OpinionConent;
import com.ruoyi.supervise.domain.ProReviewPassRefuse;
import com.ruoyi.supervise.domain.ProsAccess;
import com.ruoyi.supervise.domain.ProsCertiLogInnerText;
import com.ruoyi.supervise.domain.ProsCertificateInfoText;
import com.ruoyi.supervise.domain.ProsOpinionInfo;
import com.ruoyi.supervise.domain.ReviewExperts;
import com.ruoyi.supervise.domain.SurveyResults;
import com.ruoyi.supervise.domain.SurveyResultsApplyInfo;
import com.ruoyi.supervise.service.IProsAccessService;
import com.ruoyi.supervise.service.IProsCertificateInfoService;
import com.ruoyi.supervise.service.ISurveyResultsService;
import com.ruoyi.supervise.util.FieldStrUtils;
import com.ruoyi.supervise.util.XmlReadUtil;
import com.ruoyi.web.util.XmlNodeUtil;
import com.ruoyi.web.vo.XmlVO;

import cn.hutool.core.util.StrUtil;

/**
 * @ClassName: SurveyResultsController
 * @Description: 勘察成果审查controller
 * @Author wtj
 * @DateTime 2020年3月16日 上午9:24:24
 */
@Controller
@RequestMapping("/surResult/surResult")
public class SurveyResultsController extends BaseController{

	private String prefix = "lingshui/surResult";
	private String journalPrefix = "lingshui/journal/surResult";
	
	@Autowired
    private ISurveyResultsService surveyResultsService;
	
	@Autowired
    private IProsAccessService prosAccessService;
	
	@Autowired
	private IProsCertificateInfoService prosCertificateInfoService;
	
	@RequiresPermissions("surResult:surResult:view")
	@GetMapping()
	public String surResultAll()
	{
	    return prefix + "/surResult";
	}
	
	/**
	 * @Title: list
	 * @Description: 查询勘察成果审查table数据
	 * @Author wtj
	 * @DateTime 2020年3月17日 上午11:57:49
	 * @param surveyResults
	 * @return
	 */
    @RequiresPermissions("surResult:surResult:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(SurveyResults surveyResults)
    {
        startPage();
        List<SurveyResults> surveyResultsList=surveyResultsService.selectSurveyResultsList(surveyResults);
        return getDataTable(surveyResultsList);
    }
    
    /**
     * @Title: detail
     * @Description: 查询勘察成果审查申请信息数据
     * @Author wtj
     * @DateTime 2020年3月17日 上午11:57:32
     * @param guid
     * @param mmap
     * @return
     */
   @RequiresPermissions("surResult:surResult:apply")
   @GetMapping("/detail/{guid}")
   public String detail(@PathVariable("guid") String guid, ModelMap mmap)
   {
	   SurveyResultsApplyInfo srai=surveyResultsService.selectSurveyResultsApplyInfoByGuid(guid);
	   ProsAccess prosAccess=new ProsAccess();
	   prosAccess.setOwnerGuid(guid);
	   prosAccess.setAcceId("工程勘察合同(或工程勘察任务委托书)");
	   ProsAccess prosAccessGCKCHT=prosAccessService.selectProsAccessByOwnerGuid(prosAccess);
	   if(prosAccessGCKCHT!=null && !prosAccessGCKCHT.getAcceName().isEmpty()) {
		   String[] subStrGCKCHT=StrUtil.split(prosAccessGCKCHT.getAcceName(), "|");
		   prosAccessGCKCHT.setAcceName(Global.getConfig("ruoyi.bigPlatform")+subStrGCKCHT[1]);
		   mmap.put("prosAccessGCKCHT", prosAccessGCKCHT.getAcceName());
	   }
	   mmap.put("prosAccessGCKCHT", null);
	   prosAccess.setAcceId("勘察纲要(方案)");
	   ProsAccess prosAccessKCGY=prosAccessService.selectProsAccessByOwnerGuid(prosAccess);
	   if(prosAccessKCGY!=null && !prosAccessKCGY.getAcceName().isEmpty()) {
		   String[] subStrKCGY=StrUtil.split(prosAccessKCGY.getAcceName(), "|");
		   prosAccessKCGY.setAcceName(Global.getConfig("ruoyi.bigPlatform")+subStrKCGY[1]);
		   mmap.put("prosAccessKCGY", prosAccessKCGY.getAcceName());
	   }
	   mmap.put("prosAccessKCGY", null);
	   prosAccess.setAcceId("勘察现场原始记录表(含钻探班报表、地质编录表、钻孔验收记录表)");
	   ProsAccess prosAccessYSJLB=prosAccessService.selectProsAccessByOwnerGuid(prosAccess);
	   if(prosAccessYSJLB!=null && !prosAccessYSJLB.getAcceName().isEmpty()) {
		   String[] subStrYSJLB=StrUtil.split(prosAccessYSJLB.getAcceName(), "|");
		   prosAccessYSJLB.setAcceName(Global.getConfig("ruoyi.bigPlatform")+subStrYSJLB[1]);
		   mmap.put("prosAccessYSJLB", prosAccessYSJLB.getAcceName());
	   }
	   mmap.put("prosAccessYSJLB", null); 
	   prosAccess.setAcceId("取样、送样见证记录");
	   ProsAccess prosAccessQYSY=prosAccessService.selectProsAccessByOwnerGuid(prosAccess);
	   if(prosAccessQYSY!=null && !prosAccessQYSY.getAcceName().isEmpty()) {
		   String[] subStrQYSY=StrUtil.split(prosAccessQYSY.getAcceName(), "|");
		   prosAccessQYSY.setAcceName(Global.getConfig("ruoyi.bigPlatform")+subStrQYSY[1]);
		   mmap.put("prosAccessQYSY", prosAccessQYSY.getAcceName());
	   }
	   mmap.put("prosAccessQYSY", null);
	   prosAccess.setAcceId("工程勘察报告");
	   ProsAccess prosAccessKCBG=prosAccessService.selectProsAccessByOwnerGuid(prosAccess);
	   if(prosAccessKCBG!=null && !prosAccessKCBG.getAcceName().isEmpty()) {
		   String[] subStrKCBG=StrUtil.split(prosAccessKCBG.getAcceName(), "|");
		   prosAccessKCBG.setAcceName(Global.getConfig("ruoyi.bigPlatform")+subStrKCBG[1]);
		   mmap.put("prosAccessKCBG", prosAccessKCBG.getAcceName());
	   }
	   mmap.put("prosAccessKCBG", null); 
	   prosAccess.setAcceId("其他资料");
	   ProsAccess prosAccessQT=prosAccessService.selectProsAccessByOwnerGuid(prosAccess);
	   if(prosAccessQT!=null && !prosAccessQT.getAcceName().isEmpty()) {
		   String[] subStrQT=StrUtil.split(prosAccessQT.getAcceName(), "|");
		   prosAccessQT.setAcceName(Global.getConfig("ruoyi.bigPlatform")+subStrQT[1]);
		   mmap.put("prosAccessQT", prosAccessQT.getAcceName());
	   }
	   mmap.put("prosAccessQT", null);
	   mmap.put("srai", srai);
	   try {
		    XmlVO vo = new XmlVO();
		    vo.setGuid("Guid");
		    vo.setIDNumber("IDNumber");
		    vo.setCertificateNum("CertificateNum");
		    vo.setName("Name");
		    vo.setTitle("Title");
		    String strRegistNames=null;
	   		List<XmlVO> registNamesList=XmlNodeUtil.getXmlNode3(srai.getPersons(),vo,"RegistNames");
	   		if(!StringUtils.isEmpty(registNamesList)) {
	   			for(XmlVO x:registNamesList) {
		   			if(strRegistNames == null) {
		   				strRegistNames=x.getName();
					}else {
						strRegistNames=strRegistNames+","+x.getName();
					}
		   		}
	   		}
	   		mmap.put("strRegistNames", strRegistNames);
	   		String strProjectDir=null;
	   		List<XmlVO> projectDirList=XmlNodeUtil.getXmlNode3(srai.getPersons(),vo,"ProjectDir");
	   		if(!StringUtils.isEmpty(projectDirList)) {
	   			for(XmlVO x:projectDirList) {
		   			if(strProjectDir == null) {
		   				strProjectDir=x.getName();
					}else {
						strProjectDir=strProjectDir+","+x.getName();
					}
		   		}
	   		}
	   		mmap.put("strProjectDir", strProjectDir);
	   		String strAuditPers=null;
	   		List<XmlVO> auditPersList=XmlNodeUtil.getXmlNode3(srai.getPersons(),vo,"AuditPers");
	   		if(!StringUtils.isEmpty(auditPersList)) {
	   			for(XmlVO x:auditPersList) {
		   			if(strAuditPers == null) {
		   				strAuditPers=x.getName();
					}else {
						strAuditPers=strAuditPers+","+x.getName();
					}
		   		}
	   		}
	   		mmap.put("strAuditPers", strAuditPers);
	   		String strValidators=null;
	   		List<XmlVO> validatorsList=XmlNodeUtil.getXmlNode3(srai.getPersons(),vo,"Validators");
	   		if(!StringUtils.isEmpty(validatorsList)) {
	   			for(XmlVO x:validatorsList) {
		   			if(strValidators == null) {
		   				strValidators=x.getName();
					}else {
						strValidators=strValidators+","+x.getName();
					}
		   		}
	   		}
	   		mmap.put("strValidators", strValidators);
	   		String strBZPerson=null;
	   		List<XmlVO> bZPersonList=XmlNodeUtil.getXmlNode3(srai.getPersons(),vo,"BZPerson");
	   		if(!StringUtils.isEmpty(bZPersonList)) {
	   			for(XmlVO x:bZPersonList) {
		   			if(strBZPerson == null) {
		   				strBZPerson=x.getName();
					}else {
						strBZPerson=strBZPerson+","+x.getName();
					}
		   		}
	   		}
	   		mmap.put("strBZPerson", strBZPerson);
	   		String strDrillingDirs=null;
	   		List<XmlVO> drillingDirsList=XmlNodeUtil.getXmlNode3(srai.getPersons(),vo,"DrillingDirs");
	   		if(!StringUtils.isEmpty(drillingDirsList)) {
	   			for(XmlVO x:drillingDirsList) {
		   			if(strDrillingDirs == null) {
		   				strDrillingDirs=x.getName();
					}else {
						strDrillingDirs=strDrillingDirs+","+x.getName();
					}
		   		}
	   		}
	   		mmap.put("strDrillingDirs", strDrillingDirs);
	   		String strMajors=null;
	   		List<XmlVO> majorsList=XmlNodeUtil.getXmlNode3(srai.getPersons(),vo,"Majors");
	   		if(!StringUtils.isEmpty(majorsList)) {
	   			for(XmlVO x:majorsList) {
		   			if(strMajors == null) {
		   				strMajors=x.getName();
					}else {
						strMajors=strMajors+","+x.getName();
					}
		   		}
	   		}
	   		mmap.put("strMajors", strMajors);
	   		String strRepresentative=null;
	   		List<XmlVO> representativeList=XmlNodeUtil.getXmlNode3(srai.getPersons(),vo,"Representative");
	   		if(!StringUtils.isEmpty(representativeList)) {
	   			for(XmlVO x:representativeList) {
		   			if(strRepresentative == null) {
		   				strRepresentative=x.getName();
					}else {
						strRepresentative=strRepresentative+","+x.getName();
					}
		   		}
	   		}
	   		mmap.put("strRepresentative", strRepresentative);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	   return prefix + "/surResultDetail";
   }
   
   /**
    * @Title: certificateTable
    * @Description: 弹框跳转合格证编辑日志table
    * @Author wtj
    * @DateTime 2020年4月1日 上午11:44:43
    * @param guid
    * @param mmap
    * @return
    */
   @RequiresPermissions("surResult:surResult:cert")
   @GetMapping("/certificateTable/{guid}")
   public String certificateTable(@PathVariable("guid") String guid,ModelMap mmap)
   {
	   mmap.put("guid", guid);
	   return prefix + "/certificateModifyLogTable";
   }
   
   @RequiresPermissions("surResult:surResult:cert")
   @PostMapping("/certificateTableInfo/{guid}")
   @ResponseBody
   public TableDataInfo certificateTableInfo(@PathVariable("guid") String guid)
   {
       startPage();
       List<ProsCertiLogInnerText> clit = prosCertificateInfoService.selectProsCertiLogByProReviewGuid(guid);
       return getDataTable(clit);
   }
   
   @RequiresPermissions("surResult:surResult:cert")
   @GetMapping("/detailCertificate/{guid}")
   public String detailCertificate(@PathVariable("guid") String guid,ModelMap mmap)
   {
	   ProsCertificateInfoText pcit = prosCertificateInfoService.selectProsCertiLogTxtByGuid(guid);
	   mmap.put("pcit", pcit);
	   return prefix+"/detailCertificate";
   }
   
   /**
    * @Title: journal
    * @Description: 跳转到勘察成果审查日志列表页面
    * @Author wtj
    * @DateTime 2020-7-28 14:29:59
    * @return
    */
   @RequiresPermissions("surResult:surResult:log")
   @GetMapping("/surResultJournal/{guid}")
   public String journal(@PathVariable("guid") String guid,ModelMap mmap)
   {
	   SurveyResultsApplyInfo srai=surveyResultsService.selectSurveyResultsApplyInfoByGuid(guid);
	   if(StringUtils.isNull(srai)) {
		   throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
	   }
	   mmap.put("guid", guid);
	   mmap.put("projectName", srai.getProjectName());
	   return journalPrefix + "/surResultJournal";
   }
   
   /**
    * @Title: surResultJournal
    * @Description: 获取勘察成果审查日志列表页面的数据
    * @Author wtj
    * @DateTime 2020-7-28 14:39:02
    * @param guid
    * @return
    */
   @RequiresPermissions("surResult:surResult:log")
   @PostMapping("/surResultJournal/{dataGuid}")
   @ResponseBody
   public TableDataInfo surResultJournal(@PathVariable("dataGuid") String dataGuid)
   {
	   startPage();
	   return getDataTable(surveyResultsService.selectProsOpinionInfoByDataGuid(dataGuid));
   }
   
   /**
    * @Title: surResultJournalDetadil
    * @Description: 勘察成果日志详情接口
    * @Author wtj
    * @DateTime 2020-8-4 9:52:02
    * @param guid
    * @param mmap
    * @return
    */
   @RequiresPermissions("surResult:surResult:log")
   @GetMapping("/surResultJournalDetadil/{guid}")
   public String surResultJournalDetadil(@PathVariable("guid") String guid,ModelMap mmap)
   {
	   ProsOpinionInfo poi = surveyResultsService.selectProsOpinionInfoByGuid(guid);
	   if(StringUtils.isNull(poi)) {
		   throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
	   }
	   mmap.put("poi", poi);
	   SurveyResultsApplyInfo srai = surveyResultsService.selectSurveyResultsApplyInfoByGuid(poi.getDataGuid());
	   if(StringUtils.isNull(srai)) {
		   throw new LSBusinessException("数据获取不正确，请确认选择的是否正确");
	   }
	   mmap.put("srai", srai);
	   Emphasize e = new Emphasize();
	   e.setGuid("Guid");
	   e.setItemNo("ItemNo");
	   e.setStandardNo("StandardNo");
	   e.setEnabled("Enabled");
	   OpinionConent oc = new OpinionConent();
	   oc.setGuid("Guid");
	   oc.setDescription("Description");
	   oc.setReplyConclusion("ReplyConclusion");
	   oc.setReplyOpinion("ReplyOpinion");
	   oc.setExpertConclusion("ExpertConclusion");
	   oc.setExpertOpinion("ExpertOpinion");
	   oc.setExpertName("ExpertName");
	   oc.setExpertGuid("ExpertGuid");
	   oc.setReplyExpertGuid("ReplyExpertGuid");
	   oc.setReplyExpertName("ReplyExpertName");
	   Affix a = new Affix();
       a.setGuid("Guid");
       a.setAcceName("AcceName");
       a.setAcceId("AcceId");
       a.setOperator("Operator");
       a.setCreateDate("CreateDate");
       a.setCategoryID("CategoryID");
       a.setOwnerGuid("OwnerGuid");
       a.setSortID("SortID");
       a.setCopy("Copy");
       a.setLatestCopy("LatestCopy");
       ReviewExperts re = new ReviewExperts();
	   re.setGuid("Guid");
	   re.setName("Name");
	   re.setSex("Sex");
	   re.setPhone("Phone");
	   re.setTitles("Titles");
	   re.setProfessional("Professional");
	   re.setLoginID("LoginID");
	   re.setWorkCompany("WorkCompany");
	   re.setTaskGuid("TaskGuid");
	   re.setNewExpertGuid("NewExpertGuid");
	   re.setNewExpertName("NewExpertName");
	   CheckConclu cc= new CheckConclu();
	   cc.setName("OperatorName");
	   cc.setConclusion("Conclusion");
	   if("程序性审查退回".equals(poi.getRole()) || "程序性审查通过".equals(poi.getRole())) {
		   ProReviewPassRefuse prpr = surveyResultsService.ProReviewPassRefuseDetail(guid);
		   mmap.put("prpr", prpr);
		   return journalPrefix + "/proceduralReview";
		   //页面已接入
	   }else if("指定审查人员".equals(poi.getRole()) && "程序性审查通过".equals(poi.getState())) {
		   //一般只拿审查人员，变更后人员这两个字段
		   String nodePath = "/PsDataPacket/FDataList/ReviewExpert";
		   List<ReviewExperts> reList = XmlReadUtil.getReviewExpertsXml(poi.getReviewExperts(), nodePath, re);
		   mmap.put("reList", reList);
		   return journalPrefix + "/firstDesignateDreviewers";
		   //页面已接入
	   }else if("指定审查人员".equals(poi.getRole()) && "整改后重新上报".equals(poi.getState())) {
		   //答复附件
		   List<Affix> aList = XmlReadUtil.getAffixXml(poi.getAffix(), "/PsDataPacket", a);
		   String file = null;
		   if(!StringUtils.isEmpty(aList)) {
			   file = FieldStrUtils.fileField(aList.get(0).getAcceName());
		   }
		   mmap.put("file", file);
		   //违反强制性条文
		   List<Emphasize> emphasizeList = XmlReadUtil.getEmphasizeXml(poi.getEmphasizeList(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("emphasizeList", emphasizeList);
		   //违反一般规范条文
		   List<Emphasize> generalCommentList = XmlReadUtil.getEmphasizeXml(poi.getGeneralComment(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("generalCommentList", generalCommentList);
		   //违反规定或管理要求
		   List<OpinionConent> manageCommentList = XmlReadUtil.getOpinionConentXml(poi.getManageComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("manageCommentList", manageCommentList);
		   //存在一般错漏问题
		   List<OpinionConent> finalCommentList = XmlReadUtil.getOpinionConentXml(poi.getFinalComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("finalCommentList", finalCommentList);
		   //专家列表
		   String nodePath = "/PsDataPacket/FDataList/ReviewExpert";
		   List<ReviewExperts> reList = XmlReadUtil.getReviewExpertsXml(poi.getReviewExperts(), nodePath, re);
		   mmap.put("reList", reList);
		   return journalPrefix + "/designateDreviewers";
		   //页面已接入
	   }else if("审查人员初审".equals(poi.getRole()) && StrUtil.containsIgnoreCase(poi.getState(), "专家初审")) {
		   //违反强制性条文
		   List<Emphasize> emphasizeList = XmlReadUtil.getEmphasizeXml(poi.getEmphasizeList(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("emphasizeList", emphasizeList);
		   //违反一般规范条文
		   List<Emphasize> generalCommentList = XmlReadUtil.getEmphasizeXml(poi.getGeneralComment(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("generalCommentList", generalCommentList);
		   //违反规定或管理要求
		   List<OpinionConent> manageCommentList = XmlReadUtil.getOpinionConentXml(poi.getManageComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("manageCommentList", manageCommentList);
		   //存在一般错漏问题
		   List<OpinionConent> finalCommentList = XmlReadUtil.getOpinionConentXml(poi.getFinalComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("finalCommentList", finalCommentList);
		   return journalPrefix + "/firstTrial";
		   //页面已接入
	   }else if("技术负责人审查退回".equals(poi.getRole()) && ("审查人员初审".equals(poi.getState()) || StrUtil.containsIgnoreCase(poi.getState(), "专家初审"))) {
		   //(已经修改完成)
		   //审查人员审查意见开始
		   List<ProsOpinionInfo> poiedList = surveyResultsService.selectProsOpinionInfoByPGuid(poi.getGuid());
		   if(StringUtils.isNotEmpty(poiedList)) {
			   List<Emphasize> checkEmphasizeList = new ArrayList<Emphasize>();
			   List<Emphasize> checkGeneralCommentList = new ArrayList<Emphasize>();
			   List<OpinionConent> checkManageCommentList = new ArrayList<OpinionConent>();
			   List<OpinionConent> checkfinalCommentList = new ArrayList<OpinionConent>();
			   for(ProsOpinionInfo poied:poiedList) {
				   //违反强制性条文
				   List<Emphasize> checkEmphasizeLista = XmlReadUtil.getEmphasizeXml(poied.getEmphasizeList(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
				   for(Emphasize checkEmphasize:checkEmphasizeLista) {
					   checkEmphasizeList.add(checkEmphasize);
				   }
				   //违反一般规范条文
				   List<Emphasize> checkGeneralCommentLista = XmlReadUtil.getEmphasizeXml(poied.getGeneralComment(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
				   for(Emphasize checkGeneralComment:checkGeneralCommentLista) {
					   checkGeneralCommentList.add(checkGeneralComment);
				   }
				   //违反规定或管理要求
				   List<OpinionConent> checkManageCommentLista = XmlReadUtil.getOpinionConentXml(poied.getManageComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
				   for(OpinionConent checkManageComment:checkManageCommentLista) {
					   checkManageCommentList.add(checkManageComment);
				   }
				   //存在一般错漏问题
				   List<OpinionConent> checkfinalCommentLista = XmlReadUtil.getOpinionConentXml(poied.getFinalComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
				   for(OpinionConent checkfinalComment:checkfinalCommentLista) {
					   checkfinalCommentList.add(checkfinalComment);
				   }
			   }
			   mmap.put("checkEmphasizeList", checkEmphasizeList);
			   mmap.put("checkGeneralCommentList", checkGeneralCommentList);
			   mmap.put("checkManageCommentList", checkManageCommentList);
			   mmap.put("checkfinalCommentList", checkfinalCommentList);
		   }
		   //审查结论
		   List<CheckConclu> ccList = XmlReadUtil.getCheckConcluXml(poi.getExpertOpinions(), "/PsDataPacket/FDataList/OpinionInfo", cc);
		   mmap.put("ccList", ccList);
		   //审查人员审查意见结束
//		   //专家姓名
//		   String checkOperatorName = String.valueOf(XmlReadUtil.getAStringXml(poi.getExpertOpinions(),"/PsDataPacket/FDataList/OpinionInfo/OperatorName"));
//		   mmap.put("checkOperatorName", checkOperatorName);
//		   //结论
//		   String checkConclusion = String.valueOf(XmlReadUtil.getAStringXml(poi.getExpertOpinions(),"/PsDataPacket/FDataList/OpinionInfo/Conclusion"));
//		   mmap.put("checkConclusion", checkConclusion);
		   //技术负责人审核意见开始
		   //违反强制性条文
		   List<Emphasize> emphasizeList = XmlReadUtil.getEmphasizeXml(poi.getEmphasizeList(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("emphasizeList", emphasizeList);
		   //违反一般规范条文
		   List<Emphasize> generalCommentList = XmlReadUtil.getEmphasizeXml(poi.getGeneralComment(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("generalCommentList", generalCommentList);
		   //违反规定或管理要求
		   List<OpinionConent> manageCommentList = XmlReadUtil.getOpinionConentXml(poi.getManageComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("manageCommentList", manageCommentList);
		   //存在一般错漏问题
		   List<OpinionConent> finalCommentList = XmlReadUtil.getOpinionConentXml(poi.getFinalComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("finalCommentList", finalCommentList);
		   return journalPrefix + "/reviewReturn";
		   //页面已接入
	   }else if("技术负责人审查通过".equals(poi.getRole()) && ("审查人员初审".equals(poi.getState()) || StrUtil.containsIgnoreCase(poi.getState(), "专家初审"))) {
		   //(修改完成)
		   //审查人员审查意见开始
		   List<ProsOpinionInfo> poiedList = surveyResultsService.selectProsOpinionInfoByPGuid(poi.getGuid());
		   if(StringUtils.isNotEmpty(poiedList)) {
			   List<Emphasize> checkEmphasizeList = new ArrayList<Emphasize>();
			   List<Emphasize> checkGeneralCommentList = new ArrayList<Emphasize>();
			   List<OpinionConent> checkManageCommentList = new ArrayList<OpinionConent>();
			   List<OpinionConent> checkfinalCommentList = new ArrayList<OpinionConent>();
			   for(ProsOpinionInfo poied:poiedList) {
				   //违反强制性条文
				   List<Emphasize> checkEmphasizeLista = XmlReadUtil.getEmphasizeXml(poied.getEmphasizeList(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
				   for(Emphasize checkEmphasize:checkEmphasizeLista) {
					   checkEmphasizeList.add(checkEmphasize);
				   }
				   //违反一般规范条文
				   List<Emphasize> checkGeneralCommentLista = XmlReadUtil.getEmphasizeXml(poied.getGeneralComment(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
				   for(Emphasize checkGeneralComment:checkGeneralCommentLista) {
					   checkGeneralCommentList.add(checkGeneralComment);
				   }
				   //违反规定或管理要求
				   List<OpinionConent> checkManageCommentLista = XmlReadUtil.getOpinionConentXml(poied.getManageComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
				   for(OpinionConent checkManageComment:checkManageCommentLista) {
					   checkManageCommentList.add(checkManageComment);
				   }
				   //存在一般错漏问题
				   List<OpinionConent> checkfinalCommentLista = XmlReadUtil.getOpinionConentXml(poied.getFinalComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
				   for(OpinionConent checkfinalComment:checkfinalCommentLista) {
					   checkfinalCommentList.add(checkfinalComment);
				   }
			   }
			   mmap.put("checkEmphasizeList", checkEmphasizeList);
			   mmap.put("checkGeneralCommentList", checkGeneralCommentList);
			   mmap.put("checkManageCommentList", checkManageCommentList);
			   mmap.put("checkfinalCommentList", checkfinalCommentList);
		   }
		   //审查结论
		   List<CheckConclu> ccList = XmlReadUtil.getCheckConcluXml(poi.getExpertOpinions(), "/PsDataPacket/FDataList/OpinionInfo", cc);
		   mmap.put("ccList", ccList);
		   //审查人员审查意见结束
//		   //专家姓名
//		   String checkOperatorName = String.valueOf(XmlReadUtil.getAStringXml(poi.getExpertOpinions(),"/PsDataPacket/FDataList/OpinionInfo/OperatorName"));
//		   mmap.put("checkOperatorName", checkOperatorName);
//		   //结论
//		   String checkConclusion = String.valueOf(XmlReadUtil.getAStringXml(poi.getExpertOpinions(),"/PsDataPacket/FDataList/OpinionInfo/Conclusion"));
//		   mmap.put("checkConclusion", checkConclusion);
		   //技术负责人审核意见开始
		   //违反强制性条文
		   List<Emphasize> emphasizeList = XmlReadUtil.getEmphasizeXml(poi.getEmphasizeList(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("emphasizeList", emphasizeList);
		   //违反一般规范条文
		   List<Emphasize> generalCommentList = XmlReadUtil.getEmphasizeXml(poi.getGeneralComment(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("generalCommentList", generalCommentList);
		   //违反规定或管理要求
		   List<OpinionConent> manageCommentList = XmlReadUtil.getOpinionConentXml(poi.getManageComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("manageCommentList", manageCommentList);
		   //存在一般错漏问题
		   List<OpinionConent> finalCommentList = XmlReadUtil.getOpinionConentXml(poi.getFinalComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("finalCommentList", finalCommentList);
		   return journalPrefix + "/reviewReturn";
		   //页面已接入
	   }else if("技术性整改上报".equals(poi.getRole())) {
		   //答复附件
		   List<Affix> aList = XmlReadUtil.getAffixXml(poi.getAffix(), "/PsDataPacket", a);
		   String file = null;
		   if(!StringUtils.isEmpty(aList)) {
			   file = FieldStrUtils.fileField(aList.get(0).getAcceName());
		   }
		   mmap.put("file", file);
		   //违反强制性条文
		   List<Emphasize> emphasizeList = XmlReadUtil.getEmphasizeXml(poi.getEmphasizeList(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("emphasizeList", emphasizeList);
		   //违反一般规范条文
		   List<Emphasize> generalCommentList = XmlReadUtil.getEmphasizeXml(poi.getGeneralComment(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("generalCommentList", generalCommentList);
		   //违反规定或管理要求
		   List<OpinionConent> manageCommentList = XmlReadUtil.getOpinionConentXml(poi.getManageComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("manageCommentList", manageCommentList);
		   //存在一般错漏问题
		   List<OpinionConent> finalCommentList = XmlReadUtil.getOpinionConentXml(poi.getFinalComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("finalCommentList", finalCommentList);
		   return journalPrefix + "/technicalRectification";
		   //页面已接入
	   }else if("技术负责人审查退回".equals(poi.getRole()) && ("审查人员复审".equals(poi.getState()) || StrUtil.containsIgnoreCase(poi.getState(), "专家复审") || "整改后直接使用".equals(poi.getState())) ) {
		   //(修改完成) 
		   //上次审查意见及答复开始
		    //违反强制性条文
		    List<Emphasize> emphasizeedList = XmlReadUtil.getEmphasizeXml(poi.getPreOpinion(), "/PsDataPacket/Emphasize/FDataList", "OpinionConent", e, oc);
		    mmap.put("emphasizeedList", emphasizeedList);
		    //违反一般规范条文
			List<Emphasize> generalCommentedList = XmlReadUtil.getEmphasizeXml(poi.getPreOpinion(), "/PsDataPacket/GeneralComment/FDataList/Emphasize", "OpinionConent", e, oc);
			mmap.put("generalCommentedList", generalCommentedList);
			//违反规定或管理要求
			List<OpinionConent> manageCommentedist = XmlReadUtil.getOpinionConentXml(poi.getPreOpinion(), "/PsDataPacket/ManageComment/FDataList/OpinionItem", oc);
			mmap.put("manageCommentedist", manageCommentedist);
			//存在一般错漏问题
			List<OpinionConent> finalCommentedist = XmlReadUtil.getOpinionConentXml(poi.getPreOpinion(), "/PsDataPacket/FinalComment/FDataList/OpinionItem", oc);
			mmap.put("finalCommentedist", finalCommentedist);
			//审查结论
			String conclusion = XmlReadUtil.getAStringXml(poi.getPreOpinion(),"/PsDataPacket/Conclusion");
			mmap.put("conclusion", conclusion);
			//答复附件
			List<Affix> aList = XmlReadUtil.getAffixXml(poi.getAffix(), "/PsDataPacket", a);
			String file = null;
		    if(!StringUtils.isEmpty(aList)) {
			   file = FieldStrUtils.fileField(aList.get(0).getAcceName());
		    }
		    mmap.put("file", file);
			//上次审查意见及答复结束
			//审查人员审查意见开始
		    List<ProsOpinionInfo> poiedList = surveyResultsService.selectProsOpinionInfoByPGuid(poi.getGuid());
		   if(StringUtils.isNotEmpty(poiedList)) {
			   List<Emphasize> checkEmphasizeList = new ArrayList<Emphasize>();
			   List<Emphasize> checkGeneralCommentList = new ArrayList<Emphasize>();
			   List<OpinionConent> checkManageCommentList = new ArrayList<OpinionConent>();
			   List<OpinionConent> checkfinalCommentList = new ArrayList<OpinionConent>();
			   for(ProsOpinionInfo poied:poiedList) {
				   //违反强制性条文
				   List<Emphasize> checkEmphasizeLista = XmlReadUtil.getEmphasizeXml(poied.getEmphasizeList(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
				   for(Emphasize checkEmphasize:checkEmphasizeLista) {
					   checkEmphasizeList.add(checkEmphasize);
				   }
				   //违反一般规范条文
				   List<Emphasize> checkGeneralCommentLista = XmlReadUtil.getEmphasizeXml(poied.getGeneralComment(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
				   for(Emphasize checkGeneralComment:checkGeneralCommentLista) {
					   checkGeneralCommentList.add(checkGeneralComment);
				   }
				   //违反规定或管理要求
				   List<OpinionConent> checkManageCommentLista = XmlReadUtil.getOpinionConentXml(poied.getManageComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
				   for(OpinionConent checkManageComment:checkManageCommentLista) {
					   checkManageCommentList.add(checkManageComment);
				   }
				   //存在一般错漏问题
				   List<OpinionConent> checkfinalCommentLista = XmlReadUtil.getOpinionConentXml(poied.getFinalComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
				   for(OpinionConent checkfinalComment:checkfinalCommentLista) {
					   checkfinalCommentList.add(checkfinalComment);
				   }
			   }
			   mmap.put("checkEmphasizeList", checkEmphasizeList);
			   mmap.put("checkGeneralCommentList", checkGeneralCommentList);
			   mmap.put("checkManageCommentList", checkManageCommentList);
			   mmap.put("checkfinalCommentList", checkfinalCommentList);
		   }
		   //审查结论
 		   List<CheckConclu> ccList = XmlReadUtil.getCheckConcluXml(poi.getExpertOpinions(), "/PsDataPacket/FDataList/OpinionInfo", cc);
		   mmap.put("ccList", ccList);
		   //审查人员审查意见结束
//		   //专家姓名
//		   String checkOperatorName = String.valueOf(XmlReadUtil.getAStringXml(poi.getExpertOpinions(),"/PsDataPacket/FDataList/OpinionInfo/OperatorName"));
//		   mmap.put("checkOperatorName", checkOperatorName);
//		   //结论
//		   String checkConclusion = String.valueOf(XmlReadUtil.getAStringXml(poi.getExpertOpinions(),"/PsDataPacket/FDataList/OpinionInfo/Conclusion"));
//		   mmap.put("checkConclusion", checkConclusion);
		   //技术负责人审核意见开始
		   //违反强制性条文
		   List<Emphasize> emphasizeList = XmlReadUtil.getEmphasizeXml(poi.getEmphasizeList(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("emphasizeList", emphasizeList);
		   //违反一般规范条文
		   List<Emphasize> generalCommentList = XmlReadUtil.getEmphasizeXml(poi.getGeneralComment(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("generalCommentList", generalCommentList);
		   //违反规定或管理要求
		   List<OpinionConent> manageCommentList = XmlReadUtil.getOpinionConentXml(poi.getManageComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("manageCommentList", manageCommentList);
		   //存在一般错漏问题
		   List<OpinionConent> finalCommentList = XmlReadUtil.getOpinionConentXml(poi.getFinalComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("finalCommentList", finalCommentList);
		   //技术负责人审核意见结束
		   return journalPrefix + "/reviewApproved";
		   //页面已接入
	   }else if("技术负责人审查通过".equals(poi.getRole()) && ("审查人员复审".equals(poi.getState()) || StrUtil.containsIgnoreCase(poi.getState(), "专家复审") || "整改后直接使用".equals(poi.getState())) ) {
	       //(修改完成) 
		   //上次审查意见及答复开始
		    //违反强制性条文
		    List<Emphasize> emphasizeedList = XmlReadUtil.getEmphasizeXml(poi.getPreOpinion(), "/PsDataPacket/Emphasize/FDataList", "OpinionConent", e, oc);
		    mmap.put("emphasizeedList", emphasizeedList);
		    //违反一般规范条文
			List<Emphasize> generalCommentedList = XmlReadUtil.getEmphasizeXml(poi.getPreOpinion(), "/PsDataPacket/GeneralComment/FDataList/Emphasize", "OpinionConent", e, oc);
			mmap.put("generalCommentedList", generalCommentedList);
			//违反规定或管理要求
			List<OpinionConent> manageCommentedist = XmlReadUtil.getOpinionConentXml(poi.getPreOpinion(), "/PsDataPacket/ManageComment/FDataList/OpinionItem", oc);
			mmap.put("manageCommentedist", manageCommentedist);
			//存在一般错漏问题
			List<OpinionConent> finalCommentedist = XmlReadUtil.getOpinionConentXml(poi.getPreOpinion(), "/PsDataPacket/FinalComment/FDataList/OpinionItem", oc);
			mmap.put("finalCommentedist", finalCommentedist);
			//审查结论
			String conclusion = XmlReadUtil.getAStringXml(poi.getPreOpinion(),"/PsDataPacket/Conclusion");
			mmap.put("conclusion", conclusion);
			//答复附件
			List<Affix> aList = XmlReadUtil.getAffixXml(poi.getAffix(), "/PsDataPacket", a);
			String file = null;
		   if(!StringUtils.isEmpty(aList)) {
			   file = FieldStrUtils.fileField(aList.get(0).getAcceName());
		   }
		   mmap.put("file", file);
			//上次审查意见及答复结束
		   //审查人员审查意见开始
		   List<ProsOpinionInfo> poiedList = surveyResultsService.selectProsOpinionInfoByPGuid(poi.getGuid());
		   if(StringUtils.isNotEmpty(poiedList)) {
			   List<Emphasize> checkEmphasizeList = new ArrayList<Emphasize>();
			   List<Emphasize> checkGeneralCommentList = new ArrayList<Emphasize>();
			   List<OpinionConent> checkManageCommentList = new ArrayList<OpinionConent>();
			   List<OpinionConent> checkfinalCommentList = new ArrayList<OpinionConent>();
			   for(ProsOpinionInfo poied:poiedList) {
				   //违反强制性条文
				   List<Emphasize> checkEmphasizeLista = XmlReadUtil.getEmphasizeXml(poied.getEmphasizeList(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
				   for(Emphasize checkEmphasize:checkEmphasizeLista) {
					   checkEmphasizeList.add(checkEmphasize);
				   }
				   //违反一般规范条文
				   List<Emphasize> checkGeneralCommentLista = XmlReadUtil.getEmphasizeXml(poied.getGeneralComment(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
				   for(Emphasize checkGeneralComment:checkGeneralCommentLista) {
					   checkGeneralCommentList.add(checkGeneralComment);
				   }
				   //违反规定或管理要求
				   List<OpinionConent> checkManageCommentLista = XmlReadUtil.getOpinionConentXml(poied.getManageComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
				   for(OpinionConent checkManageComment:checkManageCommentLista) {
					   checkManageCommentList.add(checkManageComment);
				   }
				   //存在一般错漏问题
				   List<OpinionConent> checkfinalCommentLista = XmlReadUtil.getOpinionConentXml(poied.getFinalComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
				   for(OpinionConent checkfinalComment:checkfinalCommentLista) {
					   checkfinalCommentList.add(checkfinalComment);
				   }
			   }
			   mmap.put("checkEmphasizeList", checkEmphasizeList);
			   mmap.put("checkGeneralCommentList", checkGeneralCommentList);
			   mmap.put("checkManageCommentList", checkManageCommentList);
			   mmap.put("checkfinalCommentList", checkfinalCommentList);
		   }
		   //审查结论
		   List<CheckConclu> ccList = XmlReadUtil.getCheckConcluXml(poi.getExpertOpinions(), "/PsDataPacket/FDataList/OpinionInfo", cc);
		   mmap.put("ccList", ccList);
//		   //专家姓名
//		   String checkOperatorName = String.valueOf(XmlReadUtil.getAStringXml(poi.getExpertOpinions(),"/PsDataPacket/FDataList/OpinionInfo/OperatorName"));
//		   mmap.put("checkOperatorName", checkOperatorName);
//		   //结论
//		   String checkConclusion = String.valueOf(XmlReadUtil.getAStringXml(poi.getExpertOpinions(),"/PsDataPacket/FDataList/OpinionInfo/Conclusion"));
//		   mmap.put("checkConclusion", checkConclusion);
		   //审查人员审查意见结束
		   //技术负责人审核意见开始
		   //违反强制性条文
		   List<Emphasize> emphasizeList = XmlReadUtil.getEmphasizeXml(poi.getEmphasizeList(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("emphasizeList", emphasizeList);
		   //违反一般规范条文
		   List<Emphasize> generalCommentList = XmlReadUtil.getEmphasizeXml(poi.getGeneralComment(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("generalCommentList", generalCommentList);
		   //违反规定或管理要求
		   List<OpinionConent> manageCommentList = XmlReadUtil.getOpinionConentXml(poi.getManageComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("manageCommentList", manageCommentList);
		   //存在一般错漏问题
		   List<OpinionConent> finalCommentList = XmlReadUtil.getOpinionConentXml(poi.getFinalComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("finalCommentList", finalCommentList);
		   //技术负责人审核意见结束
		   return journalPrefix + "/reviewApproved";
		   //页面已接入
	   }else if("审查人员复审".equals(poi.getRole()) || StrUtil.containsIgnoreCase(poi.getState(), "专家复审")) {
		    //上次审查意见及答复开始
		    //违反强制性条文
		    List<Emphasize> emphasizeedList = XmlReadUtil.getEmphasizeXml(poi.getPreOpinion(), "/PsDataPacket/Emphasize/FDataList", "OpinionConent", e, oc);
		    mmap.put("emphasizeedList", emphasizeedList);
		    //违反一般规范条文
			List<Emphasize> generalCommentedList = XmlReadUtil.getEmphasizeXml(poi.getPreOpinion(), "/PsDataPacket/GeneralComment/FDataList/Emphasize", "OpinionConent", e, oc);
			mmap.put("generalCommentedList", generalCommentedList);
			//违反规定或管理要求
			List<OpinionConent> manageCommentedist = XmlReadUtil.getOpinionConentXml(poi.getPreOpinion(), "/PsDataPacket/ManageComment/FDataList/OpinionItem", oc);
			mmap.put("manageCommentedist", manageCommentedist);
			//存在一般错漏问题
			List<OpinionConent> finalCommentedist = XmlReadUtil.getOpinionConentXml(poi.getPreOpinion(), "/PsDataPacket/FinalComment/FDataList/OpinionItem", oc);
			mmap.put("finalCommentedist", finalCommentedist);
			//审查结论
			//String conclusion = String.valueOf(XmlUtil.getByXPath("/PsDataPacket/Conclusion", poi.getPreOpinion(), XPathConstants.STRING));
			String conclusion = XmlReadUtil.getAStringXml(poi.getPreOpinion(),"/PsDataPacket/Conclusion");
			mmap.put("conclusion", conclusion);
			//答复附件
			List<Affix> aList = XmlReadUtil.getAffixXml(poi.getAffix(), "/PsDataPacket", a);
			String file = null;
		    if(!StringUtils.isEmpty(aList)) {
			   file = FieldStrUtils.fileField(aList.get(0).getAcceName());
		    }
		    mmap.put("file", file);
			//上次审查意见及答复结束
			//本次审查意见开始
			//违反强制性条文
		   List<Emphasize> emphasizeList = XmlReadUtil.getEmphasizeXml(poi.getEmphasizeList(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("emphasizeList", emphasizeList);
		   //违反一般规范条文
		   List<Emphasize> generalCommentList = XmlReadUtil.getEmphasizeXml(poi.getGeneralComment(), "/PsDataPacket/FDataList/Emphasize", "OpinionConent", e, oc);
		   mmap.put("generalCommentList", generalCommentList);
		   //违反规定或管理要求
		   List<OpinionConent> manageCommentList = XmlReadUtil.getOpinionConentXml(poi.getManageComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("manageCommentList", manageCommentList);
		   //存在一般错漏问题
		   List<OpinionConent> finalCommentList = XmlReadUtil.getOpinionConentXml(poi.getFinalComment(), "/PsDataPacket/FDataList/OpinionItem", oc);
		   mmap.put("finalCommentList", finalCommentList);
		   //本次审查意见结束
		   return journalPrefix + "/reviewOpinions";
		   //页面已接入
	   }else if(StrUtil.containsIgnoreCase(poi.getState(), "整改后重新上报") && "整改上报退回".equals(poi.getRole())) {
		   return journalPrefix + "/rectificationOpinions";
	   }
	   return journalPrefix + "/proReviewPassRefuseDetail";
   }
}
